#include "WProgram.h"
#include "Vector2D.h"
/**
*
*
* TODO : les methodes mult, plus, min... doivent également modifier le vecteur concerné !
*
*/

Vector2D::Vector2D(float x, float y)
{
 _x=x;
 _y=y;
}

Vector2D::Vector2D()
{
}

/**
* TODO :Doc
*/
float Vector2D::det(Vector2D v)
{
 return (_x*v._y-_y*v._x);
}

/**
* TODO : Doc
*/
Vector2D Vector2D::mult(float mul)
{
 _x*=mul;
 _y*=mul;
 Vector2D res(_x,_y);
 return res;
}

/**
* TODO : Doc
*/
float Vector2D::scal(Vector2D v)
{
 return (_x*v._x+_y*v._y);
}

/**
* TODO : Doc
*/
Vector2D Vector2D::plus(Vector2D v)
{
 _x+=v._x;
 _y+=v._y;
 Vector2D res((_x),(_y));
 return res;
}

/**
* TODO : Doc
*/
Vector2D Vector2D::minus(Vector2D v)
{
 _x-=v._x;
 _y-=v._y;
 Vector2D res(_x,_y);
 return res;
}

/**
* TODO : Doc
*/
float Vector2D::norm()
{
 return sqrt(_x*_x+_y*_y);
}

/**
* TODO : Doc
*/
Vector2D Vector2D::normedVect()
{
 Vector2D v(_x/norm(),_y/norm());
 return v;
}
